import { Get, PostJson, Post, PostForm } from './request';

export interface IUser {
    id: number,
    name: string,
    username: string,
    salt?: string,
    email: string,
    mobile: string,
    status?: number,
    areaId: number,
    createTime?: string,
    role: roleTypes.普通账号 | roleTypes.管理员账号
}
export enum roleTypes {
    '普通账号' = 0,
    '管理员账号' = 1
}
/** 获取用户信息 */
export const getUserInfo = (userId: unknown):Promise<IUser> => Get(`/user/info${userId}`)

/** 所有用户列表 */
export const getUserList = (params: unknown):Promise<any> => Post('/user/list', params)

/** 修改密码 */
export const updatePasswordApi = (data: unknown) => Post('/user/password', data)

/** 新增用户 */
export const addUserApi = (data: unknown) => PostJson('/user/save', data)

/** 保存用户 */
export const updateUserApi = (data: unknown) => PostJson('/user/update', data)

/** 删除用户 */
export const deleteUserApi = (data: any) => PostJson('/user/delete', data) 